<template>
	<view class="outsize">
		<view>
			<view style="display: flex;justify-content: center;padding-top: 15vh;">
				<image show-menu-by-longpress :src="imgess" mode="widthFix" class="img"></image>
			</view>
			<view style="text-align: center;font-weight: bold;padding-bottom: 10vh;padding-top: 5vh;">
				长按识别二维码
			</view>
			<view style="text-align: center;margin-top: 7vh;">
				分享专属房源二维码 , 享房源上传分润酬谢!
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad,
		onShareTimeline,
		onShareAppMessage,
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue';
	onLoad((option) => {
		console.log(option.id)
		let one = option.id
		let two
		console.log(one.substring(1, 5), 99999)
		if (one.substring(1, 5) !== 'http') {
			two = decodeURIComponent(one)
			imgess.value = JSON.parse(two)
		} else {
			imgess.value = JSON.parse(one)
		}
	})
	const imgess = ref()
	// 分享朋友圈
	onShareTimeline(() => {
		let fileList = JSON.stringify(imgess.value)
		console.log(fileList, '分享朋友圈')
		return {
			title: '有房出租，邻里帮您租！' +
				'房东直租，租客0佣，' +
				'小额酬谢分享，大爱爽爽贵阳！',
			query: `id=${fileList}`, // 可不填 传递的参数，只能是这种格式
		}
	})
	// 分享朋友
	onShareAppMessage(() => {
		let fileList = JSON.stringify(imgess.value)
		console.log(fileList, '分享朋友')
		return {
			title: '有房出租，邻里帮您租！' +
				'房东直租，租客0佣，' +
				'小额酬谢分享，大爱爽爽贵阳！',
			query: `id=${fileList}`, // 可不填 传递的参数，只能是这种格式
		}
	})
</script>

<style scoped lang="scss">
	.outsize {
		width: 100vw;
		height: 100vh;
		// display: flex;
		// justify-content: center;
		// align-items: center;
		// flex-wrap: wrap;
		background-image: radial-gradient(circle at center, #ffffff, #FFF7D0);

		.img {
			width: 50vw;
		}
	}
</style>